import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-06-26
 * Time:17:39
 */
public class TestDemo {

    public static Set<Integer> fun1(int[] array) {
        Set<Integer> set = new HashSet<>();
        for (int x:array) {
            set.add(x);
        }
        return set;

    }

    //相同数据的个数
    public static Map<Integer, Integer> count(int[] array) {
        Map map = new HashMap<>();
        for (int i = 0; i < array.length; i++) {
            if (map.containsKey(array[i])) {
                int tmp = (int) map.get(array[i]);
                map.put(array[i], tmp + 1);
            } else {
                map.put(array[i], 1);
            }
        }
        return map;
    }

    public static void main(String[] args) {
        int[] array = {1, 1, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7};
        /*Random random=new Random();
        for (int i = 0; i < array.length; i++) {
            array[i]= random.nextInt(1000);
        }*/
        /*Map<Integer, Integer> map = count(array);
        System.out.println(map);*/
        Set<Integer> set=fun1(array);
        System.out.println(set);

    }


}
